package com.lch.thread.homework.w0518;

/**
 * @author: liuchenhui
 * @create: 2019-06-01 10:05
 **/
public class LinkListQueueTest {
    static LinkListQueue<String> linkListQueue = new LinkListQueue<>(10);

    static {
        init();
    }

    public static void init() {
        new Thread(() -> {
            while (true) {
                final String take = linkListQueue.take();
                System.out.println(take);
            }
        }).start();
    }

    public void add(String str) {
        try {
            Thread.sleep(100L);
            System.out.println("putData:" + str);
            linkListQueue.put(str);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        LinkListQueueTest lisk = new LinkListQueueTest();
        for (int i = 0; i < 100; i++) {
            lisk.add(i + "000");
        }
    }
}
